home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-20 | 6.9 KB | 179 lines | [TEXT/ttxt] |
- *chipmunk-basic-3.1.0-fat.hqx README*
-
- Every personal computer should have a Basic interpreter; here's one
- for the PowerMac (and 68K Macs too).
-
- Chipmunk Basic is a simple Basic interpreter, accelerated for
- PowerMacs. It is similar to the line number based MumbleSoft BASIC
- interpreters of circa 1980. Its roots are from a pascal program,
- basic.p, that was part of the test input suite to p2c, a pascal to c
- translator. Both basic.p and p2c should be in the net.sources
- archives somewhere. I cleaned up the translated source, ported it to
- the Macintosh, fixed various bugs and added several Mac specific
- features.
-
- Chipmunk Basic 3.1 is free for non-commercial or educational
- distribution and use. (but only for those who don't believe that using
- the BASIC language causes brain damage. :-) Please be aware that there
- are far better versions of BASIC available commercially. Just none that
- ran PowerPC native and were available for the Mac as of March 14th.
- It's not very fast as BASIC systems go. But it does run 150 to 200
- times faster on a PowerMac 7100/80 than Microsoft BASIC 1.0 did on my
- original Mac 128.
-
- Have fun. And please send me any bugs reports: via email to:
- rhn@netcom.com or via postal mail to: Ronald Nicholson,
- 1909 Magdalena Circle #76, Santa Clara, CA 95051 USA.
-
- * Chipmunk-Basic is (c) Copyright 1990,1994 Ronald H. Nicholson, Jr.
- * ALL RIGHTS RESERVED
- *
- * Permission to use, copy and distribute this software without fee
- * for non-commercial or educational purposes is hereby granted, provided
- * that the above copyright notice appear in all copies and that both
- * the copyright notice and this permission notice appear in supporting
- * documentation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY OF ANY KIND; not even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- PowerMac Version History (summary):
-
- 3.1.0 94Nov14 fixed on-gosub bug, input bug; added bigfont options
- 3.0.9 94Nov fixed power mgr bug, val "--" bug, cont bug
- 3.0.7 94Oct21 LET bug fixed ; subroutines with parameters fixed,
- ENDIF added, now works on system 6.0.5 and up on 68000 Macs.
- 3.0.4 94Sep08 DoScript scriptable; added cicn sprites & picts, scrolling.
- 2.9b9 bug fixes for array assignment, copy pict, ppc libs.
- 2.9b5 fat binary version. fixed cmd-copy of graphics window.
- 2.9b2 94March16 virtual memory crash bug fixed.
- 2.9b0 94March14 first native PowerPC port.
-
- ---
- Quick Reference for Chipmunk Basic v3.1 - PPC Macintosh version 94Nov
- ported by Ronald H. Nicholson, Jr. rhn@netcom.com
-
- - The interpreter includes an old fashioned line number based editor.
- - The usual amount of numeric and string operators and functions and
- file I/O statements are available.
- - The two variable types are long floats and strings with a maximum length
- of 254 characters. Variable names can be up to 31 characters long and
- are case insensitive.
- - Unusual features include:
- The ability to play accurate morse code through the Sound Manager.
- Some simple graphics commands in a separate graphics window.
-
- Operators, functions and statements include:
-
- + - * / ^ mod and or xor not > < >= <= <> =
- sqr() log() exp() sin() cos() tan() atn() pi
- abs() sgn() int() rnd() peek() val() asc() len()
- mid$() right$() left$() str$() chr$()
- goto if then else endif gosub return
- for to step next while wend
- rem let dim data read restore
- input print open for output append as close# load save
- inkey$ input$ fgetbyte# eof() fseek#
- run stop end exit quit cont renum new clear def fn
- date$ time$ timer push() pop sound morse say sub
- cls gotoxy moveto lineto graphics window scrn mouse()
- home get htab vtab pos() varptr peek() poke fre
-
- Some Examples:
-
- for i=1 to 10 : print i : next i
-
- c$ = a$ + b$ : rem string concatenation
- a$ = inkey$ : rem inkey$ is non-blocking
-
- load "sieve.bas" : rem load TEXT file as a Basic program
-
- open "filename" for output as #1 : print #1, "hello" : close #1
-
- gotoxy 0,10 : print "here" : rem text window (0,0 origin)
- x = pos(0) : rem text cursor horizontal location
- y = pos(-1) : rem vertical text cursor location
-
- graphics 0 : moveto 10,10 : lineto 110,80 : rem draw graphics line
-
- sound 440,0.5,30 : rem freq, seconds_duration, vol 0-100
- sound 0,128 : rem play snd resource 128
- morse "CQ DE N6YWU",16,40,13,700 : rem dot_wpm,vol,letter_wpm,freq
-
- ---
- Some experimental graphics commands:
- *The graphics commands in version 3.0 are beta test and may be buggy.*
-
- GRAPHICS 0 // show graphics window
- graphics -1 // hide graphics window
- graphics WINDOW x, y, width, height // graphics window setup
-
- graphics MOVETO x,y // Move pen To x,y
- graphics LINETO x,y // draw Line To x,y
- graphics OVAL x,y // oval x wide by y high
- graphics DRAWTEXT a$ // DrawText
-
- graphics RECT x1,y1,x2,y2 // FrameRect
- graphics FILLRECT x1,y1,x2,y2,pat# // PaintRect
- graphics OVAL x1,y1,x2,y2 // FrameOval
- graphics FILLOVAL x1,y1,x2,y2,pat# // PaintOval
- graphics PENSETUP xsize, ysize, [ mode, pat# ]
- graphics COLOR i // set RGBForeColor by index
- graphics COLOR r,g,b // red green blue 0-100
-
- graphics PICT x,y,n // draw 'pict' resource n
- graphics TEXTSETUP f, s, m // font, size, mode
-
- graphics (-38) // get graphics window max width
- graphics (-39) // get graphics window max height
-
- SPRITE n x, y, id // sprite n @ x,y using ICN# or cicn id
- // n from 1 to 15, 1 in frontmost plane
- // ICN# 128 - 141 included with chipbasic
- sprite n UP x // sprite #n move up x pixels
- sprite n DOWN x
- sprite n LEFT x // move LEFT (not turn as in Logo!)
- sprite n RIGHT x
- sprite n TURN d // turn CCW d degrees
- sprite n FORWARD x // move forward x pixels
- sprite n PENUP
- sprite n PENDOWN
-
- ---
- other unusual or experimental features:
-
- open "SFGetFile" for input as #2 // "SFPutFile" works for output
- open "COM1:" for input as #3 // *requires* CTB Serial Tool
- open f$ for data input as #4 // data file, no crlf text translation
- say "hello world" // *requires* the Speech Manager
- say "faster", 196, 44, 1 // string, rate, pitch, voice
- a$ = field$("aa bb cc dd", 2, " ") // "bb", similar to awk fields
- sound -1,a(0),11100 // play 1 sec. samples from array a
- macfunc("sendscript", appname$, doscript$) // send a DoScript AE
-
- - "Preferred Size" from Finder Get Info may limit maximum graphics window size
- - ICN#, cicn & PICT resources may be stored in the ".bas" program file
- - bigfont options in Prefs file
- - AppleScript scriptable. Try this script from a script editor:
- tell application "chipbasic" to DoScript "print 3+4"
-
- ---
- 1 rem "sieve.bas" , a prime number sieve benchmark
- 2 t = timer
- 3 dim f(8194)
- 4 for i = 0 to 8191 : f(i) = 1 : next i
- 5 s = 8191
- 6 for i = 0 to s
- 7 if f(i) = 0 then goto 11
- 8 p = i+i+3
- 9 for k = i+p to s step p : f(k) = 0 : next k
- 10 c = c+1
- 11 next i
- 12 print c;" primes found in ";
- 13 t = timer-t
- 14 print t;" seconds"
- 15 end
-
- --- cut here ---
-